package com.base.cn.platform.os.controller.integralgood;

import com.base.cn.platform.os.common.controller.BaseController;
import com.base.cn.platform.os.common.mybatis.Pagination;
import com.base.cn.platform.os.common.utils.DataUtil;
import com.base.cn.platform.os.common.utils.ObjectUtils;
import com.base.cn.platform.os.common.utils.StringUtils;
import com.base.cn.platform.os.common.utils.result.ResultUtil;
import com.base.cn.platform.os.entity.integralgood.IntegralCardVoucher;
import com.base.cn.platform.os.entity.integralgood.IntegralCardVoucherExpand;
import com.base.cn.platform.os.entity.integralgood.IntegralGood;
import com.base.cn.platform.os.entity.integralgood.IntegralShopType;
import com.base.cn.platform.os.service.integralgood.IntegralCardVoucherBiz;
import com.base.cn.platform.os.service.integralgood.IntegralGoodBiz;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 卡密
 * @Author: Hello豆包
 * @Date: 2019/10/18 14:43
 */
@RestController
@RequestMapping("/manage/IntegralCardVoucher/")
public class IntegralCardVoucherController extends BaseController {

    @Autowired
    private  IntegralCardVoucherBiz integralCardVoucherBiz;

    /**
     * 批量保存卡密
     * @param integralCardVouchers
     */
    @RequestMapping("saveListEntity")
    public void  saveEntity(@RequestBody List<IntegralCardVoucher> integralCardVouchers,@RequestParam("shopName") String shopName){

        integralCardVoucherBiz.virtualCardSave(integralCardVouchers,shopName);

    }
    /**
     * 获取卡密
     * @param integralCardVoucher
     * @return
     */
    @RequestMapping("geiInfoIntegralCardVoucher")
    public  Map geiInfoIntegralCardVoucher(@RequestBody IntegralCardVoucherExpand integralCardVoucher){
         return   integralCardVoucherBiz.geiInfoIntegralCardVoucher(integralCardVoucher);
    }


    /**
     * 获取列表
     * @param currentPage
     * @param integralVirtualGood
     * @return
     */
    @RequestMapping("getPageList")
    public PageInfo<IntegralCardVoucher> getPageList(@RequestParam(value = "currentPage",required = false,defaultValue = "1") int currentPage , @RequestBody IntegralCardVoucherExpand integralVirtualGood ){
        Pagination page = new Pagination();
        page.setCurrentPage(currentPage);
        return  integralCardVoucherBiz.findListPage(page,integralVirtualGood);

    }
}
